home *** CD-ROM | disk | FTP | other *** search
/ Aminet 22 / Aminet 22 (1997)(GTI - Schatztruhe)[!][Dec 1997].iso / Aminet / dev / e / amigae33a.lha / E_v3.3a / Src.lha / Src / OOmodules / library / anylibrary.e next >
Text File  |  1996-09-12  |  3KB  |  143 lines

  1. /*
  2.  
  3. Library template for any library. This object can be used to open other
  4. libraries. See it as an example how to build own library derived objects.
  5.  
  6. */
  7.  
  8. OPT MODULE
  9.  
  10.  
  11.  
  12. /*
  13.  
  14. Export everything defined in here.
  15.  
  16. */
  17. OPT EXPORT
  18.  
  19.  
  20.  
  21. /*
  22.  
  23. Include the basic library object and normal E modules of the library to
  24. implement.
  25.  
  26. */
  27.  
  28. MODULE 'oomodules/library', 'anylibrary', 'libraries/anylibrary'
  29.  
  30.  
  31.  
  32. OBJECT anylibrary OF library
  33. /****** anylibrary/--background-- ******************************************
  34.  
  35.     NAME 
  36.         anylibrary of library
  37.  
  38.     PURPOSE
  39.         Basic implementation of a simple library module.
  40.  
  41.     ATTRIBUTES
  42.         No special attributes since it's used for demonstration.
  43.  
  44.     CREATION
  45.         September 9 1996 Gregor Goldbach
  46.  
  47. ******************************************************************************
  48.  
  49. History
  50.  
  51.  
  52. */
  53. ENDOBJECT
  54.  
  55.  
  56.  
  57. PROC init() OF anylibrary
  58. /****** anylibrary/init ******************************************
  59.  
  60.     NAME 
  61.         init() -- Initialization of the object.
  62.  
  63.     SYNOPSIS
  64.         anylibrary.init()
  65.  
  66.     FUNCTION
  67.         Sets the library's name and the version to 0. After that the library
  68.         is opened.
  69.  
  70.         This menas that any version found be opened if the version isn't
  71.         changed in select().
  72.  
  73.     SEE ALSO
  74.         open()
  75. ******************************************************************************
  76.  
  77. The object attributes identifier and version are set to initial values.
  78. The version attribute may very well be changed by the "vers" tag of select()
  79. if you want to open a specific version of the library.
  80.  
  81. */
  82.  self.identifier:='anylibrary.library'
  83.  self.version:=0
  84.  self.open()
  85. ENDPROC
  86.  
  87.  
  88.  
  89. PROC open() OF anylibrary
  90. /****** anylibrary/open ******************************************
  91.  
  92.     NAME 
  93.         open() -- Open anylibrary.library
  94.  
  95.     SYNOPSIS
  96.         anylibrary.open()
  97.  
  98.     FUNCTION
  99.         Opens the anylibrary.library and sets the global library base to
  100.         the value returned by OpenLibrary().
  101.  
  102.     EXCEPTIONS
  103.         "lib",{anylibOpen} will be raised if the opening fails. You should
  104.         provide at least one exception handler to receive the exception and
  105.         act on it.
  106.  
  107. ******************************************************************************
  108.  
  109. History
  110.  
  111.  
  112. */
  113.  IF (anylibrarybase:=OpenLibrary(self.identifier,self.version)) = NIL THEN Throw("lib",{reqtoolOpen})
  114. ENDPROC
  115.  
  116.  
  117. PROC close() OF anylibrary
  118. /****** anylibrary/close ******************************************
  119.  
  120.     NAME 
  121.         close() -- Close the library.
  122.  
  123.     SYNOPSIS
  124.         anylibrary.close()
  125.  
  126.     FUNCTION
  127.         Closes the library.
  128.  
  129.     SEE ALSO
  130.         open()
  131. ******************************************************************************
  132.  
  133. History
  134.  
  135.  
  136. */
  137.   CloseLibrary(anylibrarybase)
  138. ENDPROC
  139.  
  140.  
  141. anylibOpen:
  142.  CHAR 'Unable to open anylibrary.library.',0
  143.